package middle;

import java.util.Scanner;

/**
 * JD13 疯狂序列
 * @author d3y1
 */
public class JD13{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);

        while(in.hasNext()){
            solution1(in);
            solution2(in);
            solution3(in);
        }
    }

    /**
     * 数学法
     * @param in
     */
    private static void solution1(Scanner in){
        long n = in.nextLong();
        int num = 0;

        for(int i=1; i<Integer.MAX_VALUE; i++){
            if(getSum(i) >= n){
                num = i;
                break;
            }
        }

        System.out.println(num);
    }

    private static long getSum(int m){
        return m*(m+1L)/2;
    }

    /**
     * 模拟法
     * @param in
     */
    private static void solution2(Scanner in){
        long n = in.nextLong();
        long count = 0;
        int num = 1;
        while(count < n){
            count += num;
            num++;
        }

        System.out.println(num-1);
    }

    /**
     * 数学法
     * @param in
     */
    private static void solution3(Scanner in){
        long n = in.nextLong();
        long k = (long)Math.sqrt(n<<1);

        long num;
        if(k*(k+1) >= n<<1){
            num = k;
        }else{
            num = k+1;
        }

        System.out.println(num);
    }
}